package com.zhl.study.controller;

import com.zhl.study.service.RedissonDelayQueue;
import com.zhl.study.base.ResponseFactory;
import com.zhl.study.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description 我们用Redisson实现一个优雅的延迟队列
 * @Author: z156940l@outlook.com
 * @className PayController
 * @Date: 2023/4/26 21:26
 */
@RestController
@RequestMapping("api/")
@Api(value = "redisson实现延时队列", tags = "redisson实现延时队列")
public class PayController {

    @Autowired
    RedissonDelayQueue redissonDelayQueue;

    @GetMapping("/sendMessage")
    @ApiOperation(httpMethod = "GET", value = "redisson实现延时队列消息发送")
    public Result<String> getToken() {
        redissonDelayQueue.offerTask("hello,world",15);
        return ResponseFactory.ok("ok");
    }



}